package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.BitExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.RelationExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.BinaryExpressionContext;

/**
 * binary 表达式语法遍历
 * 
 * @author zwd
 *
 */
public class BinaryExpressionVisitor extends AbsCQLParserBaseVisitor<BinaryExpressionContext> {

	private BinaryExpressionContext context = null;

	public BinaryExpressionVisitor() {
		context = new BinaryExpressionContext();
	}

	@Override
	protected BinaryExpressionContext defaultResult() {
		return context;
	}

	@Override
	public BinaryExpressionContext visitBitExpression(@NotNull BitExpressionContext ctx) {
		BitExpressionVisitor visitor = new BitExpressionVisitor();
		context.setBitExpression(visitor.visit(ctx));
		return context;
	}

	@Override
	public BinaryExpressionContext visitRelationExpression(@NotNull RelationExpressionContext ctx) {
		RelationExpressionVisitor visitor = new RelationExpressionVisitor();
		context.getRelationExpression().add(visitor.visit(ctx));
		return context;
	}

}
